<template>
  <div>
    <BaseTable :loading="store.loading" :data-source="store.tableData" :scroll="{ x: 2600 }" fill column-code="000895">
      <template #bodyCell="{ column, record }">
        <template v-if="column.dataIndex === 'auditStatus'">
          <a-tag v-if="record.auditStatus === 0" color="blue">未审核</a-tag>
          <a-tag v-if="record.auditStatus === 1" color="green">已审核</a-tag>
        </template>
        <template v-if="column.dataIndex === 'operationStTime'">
          <EditCell title="手术开始时间">
            <a-time-picker
              v-model:value="record.operationStTime"
              class="w-full"
              format="HH:mm"
              value-format="HH:mm"
              placeholder="请选择"
              :disabled="record.auditStatus === 1"
            />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'painLevel'">
          <EditCell title="疼痛程度">
            <SelectItem
              v-model:value="record.painLevelName"
              class="w-full !min-w-0"
              type="DT00315"
              trigger="focus"
              placeholder="请选择"
              @change="
                (_, $event) => {
                  record.painLevel = $event.value
                  record.painLevelName = $event.label
                }
              "
            />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'operationEdTime'">
          <EditCell title="手术反室时间">
            <a-time-picker
              v-model:value="record.operationEdTime"
              class="w-full"
              format="HH:mm"
              value-format="HH:mm"
              placeholder="请选择"
              :disabled="record.auditStatus === 1"
            />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'weight'">
          <EditCell title="体重">
            <a-input v-model:value="record.weight" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'height'">
          <EditCell title="身高">
            <a-input v-model:value="record.height" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'untOutput'">
          <EditCell title="尿量">
            <a-input v-model:value="record.untOutput" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'sptOutput'">
          <EditCell title="痰量">
            <a-input v-model:value="record.sptOutput" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'dngOutput'">
          <EditCell title="引流量">
            <a-input v-model:value="record.dngOutput" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'vomitOutput'">
          <EditCell title="呕吐量">
            <a-input v-model:value="record.vomitOutput" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'intake'">
          <EditCell title="总入量">
            <a-input v-model:value="record.intake" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'output'">
          <EditCell title="总出量">
            <a-input v-model:value="record.output" v-input:float.2 class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'dftFqc'">
          <EditCell title="大便次数">
            <a-input v-model:value="record.dftFqc" v-input:int class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'untFqc'">
          <EditCell title="小便次数">
            <a-input v-model:value="record.untFqc" v-input:int class="w-full" :disabled="record.auditStatus === 1" placeholder="请输入" />
          </EditCell>
        </template>
        <template v-if="column.dataIndex === 'xy1'">
          <div class="flex items-center justify-between">
            <div>
              <EditCell title="收缩压">
                <a-input v-model:value="record.sbp" v-input:float.2 class="!w-5/12" :disabled="record.auditStatus === 1" placeholder="请输入" />
              </EditCell>
            </div>
            <span>/</span>
            <div class="pressure">
              <EditCell title="舒张压">
                <a-input v-model:value="record.dbp" v-input:float.2 class="!w-5/12" :disabled="record.auditStatus === 1" placeholder="请输入" />
              </EditCell>
            </div>
          </div>
        </template>
        <template v-if="column.dataIndex === 'xy2'">
          <div class="flex items-center justify-between">
            <div>
              <EditCell title="收缩压">
                <a-input v-model:value="record.sbp2" v-input:float.2 class="!w-5/12" :disabled="record.auditStatus === 1" placeholder="请输入" />
              </EditCell>
            </div>
            <span>/</span>
            <div class="pressure">
              <EditCell title="舒张压">
                <a-input v-model:value="record.dbp2" v-input:float.2 class="!w-5/12" :disabled="record.auditStatus === 1" placeholder="请输入" />
              </EditCell>
            </div>
          </div>
        </template>
      </template>
    </BaseTable>
  </div>
</template>

<script setup>
import BaseTable from '@/components/BaseTable'
import useStore from '../store.js'

const store = useStore()
</script>

<style lang="less" scoped>
.pressure {
  .can-edit-cell {
    left: 58% !important;
  }
}
</style>
